// @ts-ignore
import { api } from '@/utils/api';

/** 新增通用树数据 POST /treeInfo/add */
export async function treeInfoAdd(
  body: BASE.TreeInfo,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResult>;

export async function treeInfoAdd(
  body: BASE.TreeInfo,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResult>>;

export async function treeInfoAdd(
  body: BASE.TreeInfo,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResult>;

export async function treeInfoAdd(body: BASE.TreeInfo, options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResult>(`/app/treeInfo/add`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResult>(`/app/treeInfo/add`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 删除通用树数据 POST /treeInfo/delete */
export async function treeInfoDelete(
  body: BASE.RemoveTreeDTO,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResult>;

export async function treeInfoDelete(
  body: BASE.RemoveTreeDTO,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResult>>;

export async function treeInfoDelete(
  body: BASE.RemoveTreeDTO,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResult>;

export async function treeInfoDelete(
  body: BASE.RemoveTreeDTO,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResult>(`/app/treeInfo/delete`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResult>(`/app/treeInfo/delete`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 导出树形数据信息 POST /treeInfo/exportTree */
export async function treeInfoExportTree(
  body: BASE.CodeDTO,
  options?: ArgumentsType<typeof api>[1]
): Promise<any>;

export async function treeInfoExportTree(
  body: BASE.CodeDTO,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<any>>;

export async function treeInfoExportTree(
  body: BASE.CodeDTO,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<any>;

export async function treeInfoExportTree(
  body: BASE.CodeDTO,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<any>(`/app/treeInfo/exportTree`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<any>(`/app/treeInfo/exportTree`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 导入树形数据信息接口 POST /treeInfo/import */
export async function treeInfoImport(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: BASE.treeInfoImportParams,
  body: {
    treeCode?: string;
  },
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResult>;

export async function treeInfoImport(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: BASE.treeInfoImportParams,
  body: {
    treeCode?: string;
  },
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResult>>;

export async function treeInfoImport(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: BASE.treeInfoImportParams,
  body: {
    treeCode?: string;
  },
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResult>;

export async function treeInfoImport(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: BASE.treeInfoImportParams,
  body: {
    treeCode?: string;
  },
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResult>(`/app/treeInfo/import`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      params: {
        ...params
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResult>(`/app/treeInfo/import`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    params: {
      ...params
    },
    data: body,
    ...(options || {})
  });
}

/** 获取通用树数据分页数据 POST /treeInfo/page */
export async function treeInfoPage(
  body: BASE.TreeInfoQuery,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultIPageTreeInfo>;

export async function treeInfoPage(
  body: BASE.TreeInfoQuery,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultIPageTreeInfo>>;

export async function treeInfoPage(
  body: BASE.TreeInfoQuery,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultIPageTreeInfo>;

export async function treeInfoPage(
  body: BASE.TreeInfoQuery,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultIPageTreeInfo>(`/app/treeInfo/page`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultIPageTreeInfo>(`/app/treeInfo/page`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 获取树形数据导入模板接口 POST /treeInfo/template */
export async function treeInfoTemplate(options?: ArgumentsType<typeof api>[1]): Promise<any>;

export async function treeInfoTemplate(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<any>>;

export async function treeInfoTemplate(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<any>;

export async function treeInfoTemplate(options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<any>(`/app/treeInfo/template`, {
      method: 'POST',
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<any>(`/app/treeInfo/template`, {
    method: 'POST',
    ...(options || {})
  });
}

/** 获取通用树形结构数据 POST /treeInfo/tree */
export async function treeInfoTree(
  body: BASE.TreeInfoQuery,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultListTreeInfoVO>;

export async function treeInfoTree(
  body: BASE.TreeInfoQuery,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultListTreeInfoVO>>;

export async function treeInfoTree(
  body: BASE.TreeInfoQuery,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultListTreeInfoVO>;

export async function treeInfoTree(
  body: BASE.TreeInfoQuery,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultListTreeInfoVO>(`/app/treeInfo/tree`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultListTreeInfoVO>(`/app/treeInfo/tree`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 根据树code获取树形结构数据 POST /treeInfo/tree/byCode */
export async function treeInfoTreeByCode(
  body: BASE.CodeDTO,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultListTreeInfoVO>;

export async function treeInfoTreeByCode(
  body: BASE.CodeDTO,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultListTreeInfoVO>>;

export async function treeInfoTreeByCode(
  body: BASE.CodeDTO,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultListTreeInfoVO>;

export async function treeInfoTreeByCode(
  body: BASE.CodeDTO,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultListTreeInfoVO>(`/app/treeInfo/tree/byCode`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultListTreeInfoVO>(`/app/treeInfo/tree/byCode`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 更新通用树数据 POST /treeInfo/update */
export async function treeInfoUpdate(
  body: BASE.TreeInfo,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResult>;

export async function treeInfoUpdate(
  body: BASE.TreeInfo,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResult>>;

export async function treeInfoUpdate(
  body: BASE.TreeInfo,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResult>;

export async function treeInfoUpdate(body: BASE.TreeInfo, options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResult>(`/app/treeInfo/update`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResult>(`/app/treeInfo/update`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}
